/**
 * @author kristian
 */

var companySelectFunctions = {
	
	selectIcon : function(company, context){
		var iconsPath = context.iconsPath || '';
		var type = context.nodeType || '';
		var prefix = '';
		if (type === m3gen.constants.nodeType.REFERENCE) {	
			//prefix = 'ref_';
		}
	    return iconsPath + '/' + prefix + 'user_suit.png';
	},
	
	selectTitle : function (company, options) {
	    return 'Company ' + company.name;
	},
		
	selectId : function(company, context) {
		var counter = context.counter || '';
		var id = company.id;
		var uniqueId = id + '_' + counter;
		return {id: id, uniqueId: uniqueId};
	},
	
	selectState : function(company, context) {
		var oc = function (a)
		{
		  var o = {};
		  for(var i=0;i<a.length;i++)
		  {
		    o[a[i]]='';
		  }
		  return o;
		}			
		
		var openList = context.openList || [];
		var id = companySelectFunctions.selectId(company, options);
		if (id in oc(openList))
			return "open";
		else return context.defaultState || "closed";
	}	
}


